<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<ui:composition 
	  xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      template="/view/templates/templateLayout.xhtml">
      
      <ui:define name="conteudo">      	
  	  <link rel="stylesheet" type="text/css" href="./estilos.css"/>
  	  
<h:form id="formEditarContaPagar" prependId="false">  
	<p:panel id="panelEditarContaPagar" header="Editar ContaPagar" style="margin-bottom:20px; ">  
	<f:facet name="header">
		<h:outputText value="Editar ContaPagar" styleClass="outputTextTitulo"/>
	</f:facet>
 	<p:growl id="growl"/> 
    	<h:panelGrid id="pgContaPagar" columns="4" style="margin-top:20px; margin-right:10%;">  
            <h:outputLabel value="Código" styleClass="outputLabel"/>  
            <h:outputLabel value="Descrição" styleClass="outputLabel"/>    
            <h:outputLabel value="Data Vencimento*" styleClass="outputLabel"/> 
            <h:outputLabel value="Data de Pagamento" />        
            <p:inputText value="#{contaPagarBean.contaPagar.idContaPagar}" styleClass="inputId" disabled="true"/>  
            <p:inputText value="#{contaPagarBean.contaPagar.descricao}" styleClass="inputDescricao" maxlength="40"
            				required="true" requiredMessage="Informe a descrição!"/> 
            <p:inputMask mask="99/99/9999" value="#{contaPagarBean.contaPagar.dtVencimento}"  styleClass="inputData" >
            	<f:convertDateTime dateStyle="medium"/>
            </p:inputMask>	
            <p:inputMask mask="99/99/9999" value="#{contaPagarBean.contaPagar.dtPagamento}" styleClass="inputData" >
            	<f:convertDateTime dateStyle="medium"/>
            </p:inputMask>   			
        </h:panelGrid> 
        <h:panelGrid id="pgFornecedor" columns="3" style="margin-right:10%;">  
            <h:outputLabel value="Código" styleClass="outputLabel"/>  
            <h:outputLabel value="Fornecedor*" styleClass="outputLabel"/>     
            <h:outputLabel  />           
            <p:inputText value="#{contaPagarBean.contaPagar.fornecedor.idFornecedor}" styleClass="inputId" >
            	<f:convertNumber type="number"/>
            </p:inputText>  
  			<p:inputText value="#{contaPagarBean.contaPagar.fornecedor.razaoSocial}" maxlength="40" styleClass="inputDescricao" />  
  			<p:commandButton icon="ui-icon-search" actionListener="#{contaPagarBean.openDialogConsultarFornecedor}" immediate="true"/>
        </h:panelGrid>   
       
       	<h:panelGrid id="pgCondicaoPagamento" columns="6" style="margin-right:10%;">  
           	 	<h:outputLabel value="Código" styleClass="outputLabel"/>  
            	<h:outputLabel value="Condição de Pagamento*" styleClass="outputLabel"/>      
            	<h:outputLabel  />       
            	<h:outputLabel value="Código" styleClass="outputLabel"/>  
            	<h:outputLabel value="Forma de Pagamento*" styleClass="outputLabel"/>  
            	<h:outputLabel  />     
            	<p:inputText value="#{contaPagarBean.contaPagar.condicaoPagamento.idCondicaoPagamento}" maxlength="10" styleClass="inputId" >
            		<f:convertNumber type="number"/>
            	</p:inputText>	  
  				<p:inputText value="#{contaPagarBean.contaPagar.condicaoPagamento.descricao}"  styleClass="inputDescricao" style="width:150px;" immediate="true" disabled="true"/>  
  				<p:commandButton icon="ui-icon-search" actionListener="#{contaPagarBean.openDialogConsultarCondicaoPagamento}" update="pgCondicaoPagamento" immediate="true" />  
            	<p:inputText value="#{contaPagarBean.contaPagar.condicaoPagamento.formaPagamento.idFormaPagamento}" styleClass="inputId" disabled="true"/>  
  				<p:inputText value="#{contaPagarBean.contaPagar.condicaoPagamento.formaPagamento.descricao}"  styleClass="inputDescricao" style="width:150px;" disabled="true"/>   				 
        </h:panelGrid> 
        <h:panelGrid id="pgTotal" columns="2" style="margin-right:10%;">  
        	<h:outputLabel value="Valor(R$)" styleClass="outputLabel"/>	
        	<h:outputLabel value="Juros(%)" styleClass="outputLabel"/>
        	<h:outputLabel value="Multa(R$)" styleClass="outputLabel"/>
        	<h:outputLabel value="Desconto(%)" styleClass="outputLabel"/>
        	<h:outputLabel value="Desconto(R$)" styleClass="outputLabel"/>		
            <h:outputLabel value="Total(R$)" styleClass="outputLabel"/> 
            <h:outputLabel  />
			<p:inputText value="#{contaPagarBean.contaPagar.valor}" styleClass="inputData" />     
            <p:inputText value="#{contaPagarBean.contaPagar.juros}" styleClass="inputData" />
            <p:inputText value="#{contaPagarBean.contaPagar.multa}" styleClass="inputData" />
            <p:inputText value="#{contaPagarBean.contaPagar.desconto}" styleClass="inputData" />
            <p:inputText value="#{contaPagarBean.contaPagar.descontoReal}" styleClass="inputData" />           
            <p:inputText value="#{contaPagarBean.contaPagar.valorTotal}" styleClass="inputData" disabled="true"/>  	
            <p:commandButton icon="ui-icon-calculator" actionListener="#{contaPagarBean.calculaTotalContaPagar}" process="@this pgTotal" />		
        </h:panelGrid>  	
    </p:panel>  
    <p:commandButton value="Salvar" actionListener="#{contaPagarBean.saveContaPagar}" update="panelEditarContaPagar, growl" style="margin-right:20px; margin-left:10px;" /> 
	<p:commandButton value="Cancelar" action="#{contaPagarBean.consultarContaPagar}" immediate="true" style="margin-right:20px;" /> 
</h:form>  	
<ui:include src="/view/contaPagar/dialogConsultarCondicaoPagamento.xhtml"></ui:include>
<ui:include src="/view/contaPagar/dialogConsultarFornecedor.xhtml"></ui:include>

</ui:define>
</ui:composition>
